<?php
require_once 'libraries/Utilities/function.php';
$path = "../ptnhuan-web1/data/films.txt";
$full_path = realpath($path);
$films = mreadFile($path);

?>
<form method="POST" action="edit.php"> 
    <?php
    foreach ($films as $item) {
        $my = trim($item, '\n\t\r');
        $rating = explode(";", $my);
        if ($_GET["if"] == $rating[0]) {
            ?>
            <img src = '../ptnhuan-web1/public/images/films/<?php if (!empty($rating[1])) echo $rating[1] ?>'/> </br>
            Film Name   :<input type="text" name="name" value="<?php if (!empty($rating[2])) echo $rating[2] ?>"> </br>
            Rating   :<input type="text" name="name" value="<?php if (!empty($rating[3])) echo $rating[3] ?>"> </br>
            Comment: <textarea name="comment" rows="6" cols="35"></textarea></br>
            <input type="submit" name="submit" value="Submit">
        <?php }
    }
    ?>
</form>